//
//  CenterCollectionCell.m
//  doubleEduStudents
//
//  Created by 盛洋 on 2021/1/7.
//  Copyright © 2021 shengYang. All rights reserved.
//

#import "CenterCollectionCell.h"

@implementation CenterCollectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.name_lab.font = self.birthday_lab.font = self.class_lab.font = self.change_btn.titleLabel.font = AutoLabFont2;
    [self.change_btn setHidden:YES];
}

-(void)setDic:(NSDictionary *)dic{
    _dic = dic;
    [self.change_btn setHidden:NO];
    if ([self.dic[@"realName"] CheckNSStringData]) {
        _name_lab.text = [NSString stringWithFormat:@"%@",self.dic[@"realName"]];
    }else{
        _name_lab.text = [NSString stringWithFormat:@"%@",self.dic[@"userName"]];
    }
    APPViewBorderRadius(self.icon_img, self.icon_img.frame.size.height/2, .5, [UIColor clearColor]);
    if ([self.dic[@"gender"] intValue] == 1) {
        //男
        _sex_img.image = [UIImage imageNamed:@"man"];
    }else if ([self.dic[@"gender"] intValue] == 2){
        //女
        _sex_img.image = [UIImage imageNamed:@"woman"];
    }else{
        _sex_img.image = [UIImage imageNamed:@""];
    }
    if ([self.dic[@"classes"] CheckNSStringData]) {
        _class_lab.text = [NSString stringWithFormat:@"班级：%@",self.dic[@"classes"]];
    }else{
        _class_lab.text = @"";
    }
    if ([self.dic[@"birthday"] CheckNSStringData]) {
        _birthday_lab.text = [NSString stringWithFormat:@"生日：%@",self.dic[@"birthday"]];
    }else{
        _birthday_lab.text = @"";
    }
    [_icon_img sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",self.dic[@"avatarUrl"]]] placeholderImage:DefaultIcon];
}

@end
